Repository navigation
Start V2/V3 migration. #1312 - #1413
Open
Lokowandtg wants to merge 5 commits into
Open
Lokowandtg wants to merge 5 commits into
Lokowandtg wants to merge 5 commits into
Conversation
update fork
Done with support of Claude AI. This huge task will be done in many small commits hoping this will simplify the review. Here a bunch of low risk (only integration-test) changes. ApplicationUtils.java: The creation of a new Application is more effort, as the V3 API gives more controll, which results in more steps. - applicationsV2().create() - replaced with applicationsV3().create() using ApplicationRelationships - applicationsV2().upload() - replaced with a two-step packages().create() + packages().upload() - applicationsV2().get() + ResourceUtils.getEntity().getPackageState() - replaced with polling packages().get() until PackageState.READY - applicationsV2().update(env + state=STARTED) - replaced with applicationsV3().updateEnvironmentVariables() + applicationsV3().start() - applicationsV2().instances() + ApplicationInstanceInfo.getState() - replaced with applicationsV3().getProcessStatistics(type="web") polling ProcessState.RUNNING - applicationsV2().associateRoute() - replaced with routesV3().insertDestinations() CloudFoundryCleaner.java: So far only the "simple" changes. - organizationQuotaDefinitions() replaced by organizationQuotasV3() Return value is now a mono, handled by flatMap. - organizations() replaced by organizationsV3() - securityGroups() replaced by securityGroupsV3(), return value is now a job that is polled. - serviceBrokers() replaced by serviceBrokersV3(), return value is now a job that is polled. - spaceQuotaDefinitions() replaced by spaceQuotasV3() - spaces() replaced by spacesV3(), parameter "recursive(true)" and "async" is the fixed behaviour in V3. - stacks() replaced by stacksV3() polling is no longer needed as no job is returned. IntegrationTestConfiguration.java: mostly straightforward. ServiceBrokerUtils.java: mostly straightforward.
feat: Update the used JDK version (cloudfoundry#1407)
integration-test/src/test/java/org/cloudfoundry/ServiceBrokerUtils.java
- requestCreateServiceBroker: V2 flat fields --> V3 BasicAuthentication + ServiceBrokerRelationships with space relationship; returns Mono<String> (job ID) instead of Mono<CreateServiceBrokerResponse>
- Both createServiceBroker and createServiceBrokerNonPublic: the job ID is polled via JobUtils.waitForCompletion(...), then requestGetServiceBrokerId lists brokers by name to resolve the final broker ID - replacing the old ResourceUtils.getId(response) pattern
- New requestGetServiceBrokerId helper: lists serviceBrokersV3() filtered by name, returns the single result's ID
integration-test/src/test/java/org/cloudfoundry/client/v3/IsolationSegmentsTest.java
mostly simple replacements.
requestCreateSpace: .spaces().create(CreateSpaceRequest.builder().name().organizationId()) --> .spacesV3().create(...) with SpaceRelationships / ToOneRelationship / Relationship builder chain
integration-test/src/test/java/org/cloudfoundry/networking/v1/PoliciesTest.java
- requestCreateApplication: .applicationsV2().create(...) with V2 flat fields (buildpack, diego, diskQuota, memory, spaceId) --> .applicationsV3().create(...) with ApplicationRelationships/ToOneRelationship/Relationship builder chain
- diego(true) removed - In V2, apps could run on the old DEA runtime or the newer Diego runtime. Diego became the only runtime long before V3 existed, so V3 has no such flag - all apps are Diego apps.
- buildpack(..) removed - V3 separates the build configuration from the app itself. Buildpacks are specified on the build, not on the app create. The test only needs a CF resources with a GUID so the networking policy can reference it by ID.
- diskQuota / memory removed - V3 sets resource limits on processes (via process scale), not on app creation. Again irrelevant here since the apps are never started.
integration-test/src/test/java/org/cloudfoundry/networking/v1/TagsTest.java:
The changes are identical to PoliciesTest.
integration-test/src/test/java/org/cloudfoundry/operations/NetworkPoliciesTest.java:
Same changes as PoliciesTest and TagsTest.
integration-test/src/test/java/org/cloudfoundry/operations/ServiceAdminTest.java
- requestCreateSpace: .spaces() with flat organizationId --> .spacesV3() with SpaceRelationships/ToOneRelationship/Relationship builder chain
integration-test/src/test/java/org/cloudfoundry/operations/ServicesTest.java
mostly simple replacements.
integration-test/src/test/java/org/cloudfoundry/operations/UserAdminTest.java
mostly simple replacements.
- getOrganizationId: organizations().list() + requestClientV2Resources + post-filter + ResourceUtils::getId --> organizationsV3().list(name=organizationName) + requestClientV3Resources + OrganizationResource::getId
- requestListOrganizationAuditors: single-step V2 organizations().listAuditors() returning UserResource --> two-step V3: rolesV3().list(organizationId, type=ORGANIZATION_AUDITOR) --> flatMap each role's user ID to usersV3().get(), returning
GetUserResponse
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Done with support of Claude AI.
This huge task will be done in many small commits hoping this will simplify the review.
Merge only when all changes are done.
Here a bunch of low risk (only integration-test) changes.
ApplicationUtils.java: The creation of a new Application
is more effort, as the V3 API gives more controll, which
results in more steps.
CloudFoundryCleaner.java: So far only the "simple" changes.
IntegrationTestConfiguration.java: mostly straightforward.
ServiceBrokerUtils.java: mostly straightforward.